

#ifndef _ADAFRUIT_PWMServoDriver_H
#define _ADAFRUIT_PWMServoDriver_H

#include "main.h"
#include "stdbool.h"

//0x80
//0x40
#define PCA9685_SLAVE_ADDRESS 0x40

#define PCA9685_SUBADR1 0x2
#define PCA9685_SUBADR2 0x3
#define PCA9685_SUBADR3 0x4

#define PCA9685_MODE1 0x0
#define PCA9685_PRESCALE 0xFE

#define LED0_ON_L 0x6
#define LED0_ON_H 0x7
#define LED0_OFF_L 0x8
#define LED0_OFF_H 0x9

#define ALLLED_ON_L 0xFA
#define ALLLED_ON_H 0xFB
#define ALLLED_OFF_L 0xFC
#define ALLLED_OFF_H 0xFD
//<stdbool.h>
//typedef struct bool {false = 0, true ~= false} ;


void PCA9685_Init(int fre);
void setPWMFreq(float freq);
void setPWM(u8 num, u16 on, u16 off);
void set_pwm(u8 num,  u8 off);

void write8(uint8_t reg_addr, uint8_t reg_dat);
uint8_t read8(uint8_t reg_addr);


#endif
